

# 类似 linux下的 grep

(( Get-Content myfile.txt | Select-String 'DatabaseSize = 35' -Context 3 ).context.precontext)[0]

# 如果有多个匹配项:
(Get-Content myfile.txt |  SELECT-STRING 'DATABASESIZE = 35' -Context 3 ) | % { ($_.context.precontext)[0] }